home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp95 / lx2cm.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1992-05-20  |  2KB  |  98 lines

  1. #!/bin/csh -f
  2. #
  3. #             lx2cm  rev 1.0
  4. #
  5. #        Converts HP95LX Appointments
  6. #        to OpenWindows Calendar Manager
  7. #        format.  Requires OWv3.
  8. #
  9. #        By Todd Bernhard, Product Manager
  10. #        Sun Microsystems Computer Corporation
  11. #        415-336-7047  Todd.Bernhard@Sun.COM
  12. #
  13. #
  14.  
  15. set noglob
  16. set noclobber
  17.  
  18. clear
  19. echo ""
  20. echo "        lx2cm rev 1.0"
  21. echo ""
  22. echo " HP95LX Appointment Book to"
  23. echo " OpenWindows 3.0 Calendar Manager"
  24. echo ""
  25. echo " Transfer Utility developed by Todd Bernhard,"
  26. echo " Sun Microsystems Computer Corporation"
  27. echo " 415-336-7047    Todd.Bernhard@Sun.COM"
  28. echo ""
  29. echo " This is Freeware...feel free to distribute, in"
  30. echo " the interest of Open Systems.  Modifications and"
  31. echo " enhancements are welcome."
  32. echo ""
  33. echo " Do you want instructions, Y/N?"
  34. set inst = $<
  35. switch ($inst)
  36.  case [yY] :
  37.   echo ""
  38.   echo " This program will allow you to transfer appointments"
  39.   echo " from the HP95LX scheduler to a Sun workstation, or"
  40.   echo " compatible, running OpenWindows 3.0."
  41.   echo ""
  42.   echo " To use this utility, follow these directions on the HP95LX."
  43.   echo ""
  44.   echo "    1) Within the Appointment Book program"
  45.   echo "        - Choose MENU Print File Appts Without-Notes"
  46.   echo "        - Enter Start date (e.g. 01/11/92)"
  47.   echo "        - Enter End date (e.g. 02/11/92)"
  48.   echo "        - Choose Many-Days-Per-Page"
  49.   echo "        - Enter filename to store appointments (e.g. ap.txt)"
  50.   echo ""
  51.   echo "    2) Using your favorite communications program,"
  52.   echo "       transfer the appointment file you just created"
  53.   echo "       (e.g. ap.txt) to the Sun workstation."
  54.   echo ""
  55.   echo "    3) Run this program, logged in as yourself.  The"
  56.   echo "       appointments will automatically be entered in"
  57.   echo "       your Calendar Manager."
  58.   echo ""
  59.   echo ""
  60. endsw
  61.  
  62. if ($#argv == 0) then
  63.  echo "Please enter the name of the file containing the HP95LX appointments."
  64.  set fname = $<
  65. else
  66.  set fname = $argv
  67. endif
  68.  
  69. if (! -f $fname) then
  70.  echo "No such file...sorry."
  71.  echo ""
  72.  exit 1
  73. endif
  74.  
  75. dos2unix $fname /tmp/ap$$
  76.  
  77. set hpappt = /tmp/ap$$
  78. @ linectr = 0
  79. set nl = `wc -l $hpappt`
  80. @ numlines = $nl[1]
  81.  
  82. while ($linectr != $numlines)
  83.  @ linectr++
  84.  set junkline = `head -$linectr $hpappt | tail -1`
  85.  set appline = `echo $junkline`
  86.  switch ($#appline)
  87.   case [01] : 
  88.       breaksw
  89.   case 2 :
  90.       set appdate = $appline[2]
  91.       breaksw
  92.   default:
  93.    cm_insert -d $appdate -s $appline[1]$appline[2] -w $appline 
  94.    breaksw
  95.  endsw
  96. end
  97.